package cumeo89.chii.client.form;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.PopupPanel;

public final class DialogBoxes {

	private DialogBoxes() {
	}
	
	public static PopupPanel showProgressPopup(String message) {
		ProgressPopup pp = new ProgressPopup();
		pp.setMessage(message);
		pp.center();
		return pp;
	}
	
	private static class ProgressPopup extends PopupPanel {

		private HTML message = new HTML();

		ProgressPopup() {
			super(false, true);
			setSize("400", "150");
			final HorizontalPanel horizontalPanel = new HorizontalPanel();
			setWidget(horizontalPanel);
			horizontalPanel.setSize("100%", "100%");

			final Image image = new Image();
			horizontalPanel.add(image);
			image.setUrl(GWT.getModuleBaseURL() + "images/loading_icon.gif");
			
			horizontalPanel.add(message);
		}

		void setMessage(String mess) {
			this.message.setText(mess);
		}

	}
}
